package com.woniu.serverdriveruser.controller;

import com.woniu.serverdriveruser.service.DriverUserWorkStatusService;
import com.woniu.internalcommon.dto.DriverUserWorkStatus;
import com.woniu.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/workStatus")
public class DriverWorkStatusController {
    @Autowired
    private DriverUserWorkStatusService driverUserWorkStatusService;

    /**
     *  添加司机工作状态
     * @param driverUserWorkStatus
     * @return
     */
    @PostMapping("/add")
    public ResponseResult add(@RequestBody DriverUserWorkStatus driverUserWorkStatus) {
        driverUserWorkStatusService.add(driverUserWorkStatus);
        return ResponseResult.success("添加成功");
    }

    /**
     *  查询司机工作状态
     * @param driverId
     * @return
     */
    @GetMapping("/selecStatustById")
    public ResponseResult selecStatustById(@RequestParam("driverId") Long driverId) {
        return driverUserWorkStatusService.selectById(driverId);
    }

    /**
     * 更新司机工作状态
     */
    @PutMapping("/changeWorkStatus")
    public ResponseResult changeWorkStatus(@RequestBody DriverUserWorkStatus driverUserWorkStatus) {
        driverUserWorkStatusService.update(driverUserWorkStatus);
        return ResponseResult.success("更新成功");
    }


}
